public class Main {
    public static void main(String[] args) {
        MonkeyKing monkeyKing = new MonkeyKing();
        Caretaker caretaker = new Caretaker();


        monkeyKing.setState("大闹天宫");
        caretaker.setMemento(monkeyKing.saveStateMemento());

        monkeyKing.setState("保护唐僧西天取经");
        System.out.println("当前状态："+monkeyKing.getState());

        monkeyKing.getStateMemento(caretaker.getMemento());

        System.out.println("曾经的状态："+monkeyKing.getState());
    }
}